home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / languages / pcq_incl3v1.lha / DOS / FileHandler.i < prev    next >
Encoding:
Text File  |  1994-04-15  |  6.2 KB  |  122 lines

  1. {
  2.         FileHandler.i for PCQ Pascal
  3.  
  4.         device and file handler specific code for AmigaDOS
  5. }
  6.  
  7.  
  8. {$I   "Include:Exec/Ports.i"}
  9. {$I   "Include:DOS/DOS.i"}
  10.  
  11.  
  12. { The disk "environment" is a longword array that describes the
  13.  * disk geometry.  It is variable sized, with the length at the beginning.
  14.  * Here are the constants for a standard geometry.
  15. }
  16.  
  17. Type
  18.  
  19.     DosEnvec = record
  20.         de_TableSize    : Integer;      { Size of Environment vector }
  21.         de_SizeBlock    : Integer;      { in longwords: standard value is 128 }
  22.         de_SecOrg       : Integer;      { not used; must be 0 }
  23.         de_Surfaces     : Integer;      { # of heads (surfaces). drive specific }
  24.         de_SectorPerBlock : Integer;    { not used; must be 1 }
  25.         de_BlocksPerTrack : Integer;    { blocks per track. drive specific }
  26.         de_Reserved     : Integer;      { DOS reserved blocks at start of partition. }
  27.         de_PreAlloc     : Integer;      { DOS reserved blocks at end of partition }
  28.         de_Interleave   : Integer;      { usually 0 }
  29.         de_LowCyl       : Integer;      { starting cylinder. typically 0 }
  30.         de_HighCyl      : Integer;      { max cylinder. drive specific }
  31.         de_NumBuffers   : Integer;      { Initial # DOS of buffers.  }
  32.         de_BufMemType   : Integer;      { type of mem to allocate for buffers }
  33.         de_MaxTransfer  : Integer;      { Max number of bytes to transfer at a time }
  34.         de_Mask         : Integer;      { Address Mask to block out certain memory }
  35.         de_BootPri      : Integer;      { Boot priority for autoboot }
  36.         de_DosType      : Integer;      { ASCII (HEX) string showing filesystem type;
  37.                                         * 0X444F5300 is old filesystem,
  38.                                         * 0X444F5301 is fast file system }
  39.         de_Baud         : Integer;      {     Baud rate for serial handler }
  40.         de_Control      : Integer;      {     Control word for handler/filesystem }
  41.         de_BootBlocks   : Integer;      {     Number of blocks containing boot code }
  42.     end;
  43.     DOSEnvecPtr = ^DOSEnvec;
  44.  
  45. Const
  46.  
  47. { these are the offsets into the array }
  48.  
  49.     DE_TABLESIZE        = 0;    { standard value is 11 }
  50.     DE_SIZEBLOCK        = 1;    { in longwords: standard value is 128 }
  51.     DE_SECORG           = 2;    { not used; must be 0 }
  52.     DE_NUMHEADS         = 3;    { # of heads (surfaces). drive specific }
  53.     DE_SECSPERBLK       = 4;    { not used; must be 1 }
  54.     DE_BLKSPERTRACK     = 5;    { blocks per track. drive specific }
  55.     DE_RESERVEDBLKS     = 6;    { unavailable blocks at start.   usually 2 }
  56.     DE_PREFAC           = 7;    { not used; must be 0 }
  57.     DE_INTERLEAVE       = 8;    { usually 0 }
  58.     DE_LOWCYL           = 9;    { starting cylinder. typically 0 }
  59.     DE_UPPERCYL         = 10;   { max cylinder.  drive specific }
  60.     DE_NUMBUFFERS       = 11;   { starting # of buffers.  typically 5 }
  61.     DE_MEMBUFTYPE       = 12;   { type of mem to allocate for buffers. }
  62.     DE_BUFMEMTYPE       = 12;   { same as above, better name
  63.                                  * 1 is public, 3 is chip, 5 is fast }
  64.     DE_MAXTRANSFER      = 13;   { Max number bytes to transfer at a time }
  65.     DE_MASK             = 14;   { Address Mask to block out certain memory }
  66.     DE_BOOTPRI          = 15;   { Boot priority for autoboot }
  67.     DE_DOSTYPE          = 16;   { ASCII (HEX) string showing filesystem type;
  68.                                  * 0X444F5300 is old filesystem,
  69.                                  * 0X444F5301 is fast file system }
  70.     DE_BAUD             = 17;   {     Baud rate for serial handler }
  71.     DE_CONTROL          = 18;   {     Control word for handler/filesystem }
  72.     DE_BOOTBLOCKS       = 19;   {     Number of blocks containing boot code }
  73.  
  74.  
  75. { The file system startup message is linked into a device node's startup
  76. ** field.  It contains a pointer to the above environment, plus the
  77. ** information needed to do an exec OpenDevice().
  78. }
  79.  
  80. Type
  81.  
  82.     FileSysStartupMsg = record
  83.         fssm_Unit       : Integer;      { exec unit number for this device }
  84.         fssm_Device     : BSTR;         { null terminated bstring to the device name }
  85.         fssm_Environ    : BPTR;         { ptr to environment table (see above) }
  86.         fssm_Flags      : Integer;      { flags for OpenDevice() }
  87.     end;
  88.     FileSysStartupMsgPtr = ^FileSysStartupMsg;
  89.  
  90.  
  91. { The include file "libraries/dosextens.h" has a DeviceList structure.
  92.  * The "device list" can have one of three different things linked onto
  93.  * it.  Dosextens defines the structure for a volume.  DLT_DIRECTORY
  94.  * is for an assigned directory.  The following structure is for
  95.  * a dos "device" (DLT_DEVICE).
  96. }
  97.  
  98.     DeviceNode = record
  99.         dn_Next         : BPTR;         { singly linked list }
  100.         dn_Type         : Integer;      { always 0 for dos "devices" }
  101.         dn_Task         : MsgPortPtr;   { standard dos "task" field.  If this is
  102.                                          * null when the node is accesses, a task
  103.                                          * will be started up }
  104.         dn_Lock         : BPTR;         { not used for devices -- leave null }
  105.         dn_Handler      : BSTR;         { filename to loadseg (if seglist is null) }
  106.         dn_StackSize    : Integer;      { stacksize to use when starting task }
  107.         dn_Priority     : Integer;      { task priority when starting task }
  108.         dn_Startup      : BPTR;         { startup msg: FileSysStartupMsg for disks }
  109.         dn_SegList      : BPTR;         { code to run to start new task (if necessary).
  110.                                          * if null then dn_Handler will be loaded. }
  111.         dn_GlobalVec    : BPTR; { BCPL global vector to use when starting
  112.                                  * a task.  -1 means that dn_SegList is not
  113.                                  * for a bcpl program, so the dos won't
  114.                                  * try and construct one.  0 tell the
  115.                                  * dos that you obey BCPL linkage rules,
  116.                                  * and that it should construct a global
  117.                                  * vector for you.
  118.                                  }
  119.         dn_Name         : BSTR;         { the node name, e.g. '\3','D','F','3' }
  120.     end;
  121.     DeviceNodePtr = ^DeviceNode;
  122.